package com.langsotech.studio.core.ui.pagedesigner.editors.util;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.FileReader;
import java.io.FileWriter;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class Test {
public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new FileReader(
				"e:\\jstl_core.info"));
		BufferedWriter bw = new BufferedWriter(new FileWriter("e:\\out_tag_info.txt")); 
		String temp = "";
		StringBuffer sb = new StringBuffer();
		while ((temp = br.readLine()) != null) {
			sb.append(temp + "\n");
		}
		/*Pattern p = Pattern.compile("\\<\\[([^\\[\\]]*)\\]\\>"); 
		Matcher m = p.matcher(sb.toString());
		while (m.find()) {
			System.out.println("---> " + m.group());
			bw.write(m.group().toString()); 
			bw.newLine();
		}*/
		 Pattern p = Pattern.compile("(?<=\\<\\[).*?(?=\\]\\>)",Pattern.DOTALL); 
	        Matcher m = p.matcher(sb.toString());
	        while (m.find()) {
	            System.out.println("" + m.group());
	            bw.write(m.group().toString()); 
	            bw.newLine();
	        }
		bw.flush(); 
		br.close(); 
		bw.close(); 
	}
}
